package com.sunrise.xdoc.entity.store;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

/**
 * Code PhieuNhapKho, PhieuXuatKho nen duoc sinh tu dong boi he thong, và nguoi
 * dung co the sua code nay
 * 
 */
@Entity
@Table(name = "store_phieu_nhap_kho")
@Inheritance(strategy = InheritanceType.JOINED)
public class PhieuNhapKho extends AbstractPhieuKho {
	private String nhaCungCap;
	private List<ChiTietNhapKho> chiTietNhapKhos;

	@Column(name = "nha_cung_cap")
	public String getNhaCungCap() {
		return nhaCungCap;
	}

	public void setNhaCungCap(String nhaCungCap) {
		this.nhaCungCap = nhaCungCap;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "phieuNhapKho")
	@Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DELETE })
	public List<ChiTietNhapKho> getChiTietNhapKhos() {
		return chiTietNhapKhos;
	}

	public void setChiTietNhapKhos(List<ChiTietNhapKho> chiTietNhapKhos) {
		this.chiTietNhapKhos = chiTietNhapKhos;
	}

}
